let rules = {
	base(s) {
		return s !== ''
	},
	user(s) {
		let r0 = this.phone(s)
		let r1 = this.email(s)
		return r0 || r1
	},
	phone(s) {
		let re = false
		if (s.match(/^1\d{10}$/)) {
			re = true
		}
		let st = new Set(s.split(''))
		if (st.size <= 3) {
			re = false
		}
		return re
	},
	email(s) {
		let re = false
		if (s.match(/\S+@\S+\.\S+/)) {
			re = true
		}
		return re
	},
	vercode(s) {
		let re = false
		if (s.match(/^\d{6}$/)) {
			re = true
		}
		return re
	},
	recomCode(s) {
		return s.length < 10
	},
	imgCode(s) {
		return s.length === 4
	},
	realname(s) {
		let real = false
		if (s != '') {
			real = true
		}
		return real
	},
	idcard(s) {
		let icard = false
		if (s != '') {
			icard = true
		}
		return icard
	},
	password(s) {
		let re = s.length >= 0 && s.length <= 20
		if (s.match(/^\d+$/) || s.match(/^[a-zA-Z]+$/)) {
			re = false
		}
		return re
	},
	newpassword(s) {
		let re = s.length >= 8 && s.length <= 20
		if (s.match(/^\d+$/) || s.match(/^[a-zA-Z]+$/)) {
			re = false
		}
		return re
	},
	binkCard(s) {
		let re = false
		re = s.match(/^\d{12,20}$/)
		return re
	},
}
let msgs = {
	base: {
		en: 'Enter something',
		cn: '不允许为空',
	},
	user: {
		cn: '请输入正确的手机号码',
		en: 'Incorrect user name format. Please enter again',
	},
	signupPassword: {
		cn: '密码6-18位, 且不能为纯数字或纯字母',
		en: 'The password has to contain 6-18 characters. Cannot be pure numbers',
	},
	phone: {
		cn: '请输入正确的手机号码',
		en: 'Incorrect phone number format. Please enter again',
	},
	email: {
		cn: '请输入正确的邮箱地址',
		en: 'Incorrect email address. Please enter again',
	},
	vercode: {
		cn: '请输入6位数字验证码',
		en: 'The code has to contain 6 characters',
	},
	recomCode: {
		cn: '',
		en: '',
	},
	imgCode: {
		cn: '请输入4位验证码',
		en: 'The code has to contain 4 characters',
	},
	password: {
		cn: '密码6-18位, 且不能为纯数字或纯字母',
		en: 'The password has to contain 8-20 characters. Cannot be pure numbers',
	},
	newpassword: {
		cn: '密码6-18位, 且不能为纯数字或纯字母',
		en: 'The password has to contain 8-20 characters. Cannot be pure numbers',
	},
	passwordHelp: {
		weak: {
			cn: '强度',
			en: 'strength',
		},
		length: {
			cn: '8-20位',
			en: '8-20characters',
		},
		simple: {
			cn: '不能为纯数字或纯字母',
			en: 'Cannot be pure numbers or letters',
		},
	},
	realname: {
		cn: '请输入真实姓名',
		en: 'Please enter your name',
	},
	idcard: {
		cn: '请输入有效身份证号',
		en: 'Please enter your ID Card',
	},
	binkCard: {
		cn: '请输入有效银行卡号',
		en: 'Please enter your Bank Card',
	},
}

export {rules, msgs}
